

from util.selenium.webdriver.common.by import By

from base.BaseMethod import BM
from util.DataQuery.FormDataDecorator import FormDataDecorator
from util.sys_dict import legal_type, risk_type


# 个人股东信息填写。
class WriteCivilType():
    num = 1
    @property
    def class_name(self):
        return self.__class__.__name__

    def __init__(self, driver=None):
        self.driver = driver
        if not self.driver:
            raise NameError('driver is not defind. custom--')

    @FormDataDecorator
    def write(self, type='', name='', id_num='', invest=''):
        return {"type": str(legal_type.get(type)), "name": name, "id_num": id_num, "invest": invest}


# 法人股东信息填写
class WriteLegalType():
    num = 1
    @property
    def class_name(self):
        return self.__class__.__name__

    def __init__(self, driver=None):
        self.driver = driver
        if not self.driver:
            raise NameError('driver is not defind. custom--')

    @FormDataDecorator
    def write(self, type='', name='', code='', invest=''):
        return {"type": str(legal_type.get(type)), "name": name, "id_num": code, "invest": invest}


# 风险投资法人信息填写
class WriteVentureInvestment():
    num = 1
    @property
    def class_name(self):
        return self.__class__.__name__

    def __init__(self, driver=None):
        self.driver = driver
        if not self.driver:
            raise NameError('driver is not defind. custom--')

    @FormDataDecorator
    def write(self, type='', name='', code='', invest=''):
        return {"type": str(risk_type.get(type)), "name": name, "id_num": code, "invest": invest}


def test(func):
    def wrapper(*args, **kwargs):

        for i in enumerate(range(5), 1):
            func(*args)

    return wrapper


class WriteCivilType_test():
    num = 1
    @property
    def class_name(self):
        return self.__class__.__name__

    def __init__(self, driver=None):
        self.driver = driver
        if not self.driver:
            raise NameError('driver is not defind. custom--')

    @test
    def write_civil_type(self, type='中国公民', name='叶挺', id_num='123456789101112', invest='10000'):
        self.num += 1


if __name__ == '__main__':
    # a = WriteCivilType(driver='wi')
    # na = a.__class__.__name__
    # print(f'{na} -- {CLASSMODELMAPPING.get(na)}')
    a = WriteCivilType_test(driver='wi')
    a.write_civil_type()
